package com.lul15834.orderfood.activity.user.fragment;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;

import androidx.appcompat.widget.SearchView;
import androidx.fragment.app.Fragment;

import com.lul15834.orderfood.R;
import com.lul15834.orderfood.activity.manager.adapter.CommentListAdapter;
import com.lul15834.orderfood.activity.user.adapter.FoodListUserAdapter;
import com.lul15834.orderfood.bean.CommentBean;
import com.lul15834.orderfood.bean.FoodBean;
import com.lul15834.orderfood.dao.CommentDao;
import com.lul15834.orderfood.dao.FoodDao;

import java.util.List;


public class UserBusinessCommentFragment extends Fragment {
    private String businessId;
    public UserBusinessCommentFragment(String businessId){
        this.businessId=businessId;
    }
    View rootview;//根视图

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        rootview=inflater.inflate(R.layout.fragment_user_buy_comment, container, false);
        //适配器
        ListView listView=rootview.findViewById(R.id.user_buy_comment_list);
        List<CommentBean> list=CommentDao.getCommentByBusiness(businessId);
        //适配器
        CommentListAdapter commentListAdapter=new CommentListAdapter(getContext(),list);
        if (list==null||list.size()==0){
            listView.setAdapter(null);
        }else {
            listView.setAdapter(commentListAdapter);
        }

        return rootview;
    }
}